package com.itheima.test;

import com.baidu.aip.face.AipFace;
import com.jdls.tanhua.AppServerApplication;
import com.jdls.tanhua.template.AipTemplate;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.HashMap;

/**
 * @author 嘉德罗斯
 * @date 2021/10/23
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = AppServerApplication.class)
public class BaiDu {

    @Autowired
    private AipTemplate aipTemplate;
    @Test
    public  void aip(){

        // 可选：设置代理服务器地址, http和socket二选一，或者均不设置
        //client.setHttpProxy("proxy_host", proxy_port);  // 设置http代理
        //client.setSocketProxy("proxy_host", proxy_port);  // 设置socket代理

        String image = "https://0jdls0.oss-cn-guangzhou.aliyuncs.com/2021/10/23/a63a5e57-5562-42dc-8736-ac34eb94e8d3.png";
        boolean aip = aipTemplate.aip(image);
        if(aip){
            System.out.println("有人脸");
        }else {
            System.out.println("没有人脸");
        }

    }
}
